//
//  LVGenderEditViewController.m
//  LEVE
//
//  Created by 上官惠阳 on 2017/3/1.
//  Copyright © 2017年 dashuju. All rights reserved.
//

#import "LVGenderEditViewController.h"
#import "LVSessionCell.h"

@interface LVGenderEditViewController ()

@end

@implementation LVGenderEditViewController
{
    NSIndexPath *_seletedIndexPath;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"性别";
    self.needCellSepLine = NO;
    
    [self loadData];
}
- (void)loadData
{
    [self.dataArray addObjectsFromArray:@[@"男",@"女",@"保密"]];

    [self.tableView reloadData];
}
#pragma mark UITableViewDelegate
- (NSInteger)HY_numberOfSections
{
    return 1;
}
- (NSInteger)HY_numberOfRowsInSection:(NSInteger)section
{
    return self.dataArray.count;
}
- (HYBaseTableViewCell *)HY_cellAtIndexPath:(NSIndexPath *)indexPath
{
    LVSessionCell *cell = [LVSessionCell nibCellWithTableView:self.tableView];
    cell.leftTitleLabel.text = self.dataArray[indexPath.row];
    [cell.rigthBtn setImage:[UIImage imageNamed:@"manage_selected"] forState:UIControlStateNormal];
    cell.rigthBtn.userInteractionEnabled = NO;

    if (_seletedIndexPath && _seletedIndexPath.row == indexPath.row) {
        cell.rigthBtn.hidden = NO;
    }else{
        cell.rigthBtn.hidden = YES;
    }
    return cell;
}
- (CGFloat)HY_cellheightAtIndexPath:(NSIndexPath *)indexPath
{
    return 58;
}
- (void)HY_didSelectCellAtIndexPath:(NSIndexPath *)indexPath cell:(HYBaseTableViewCell *)cell
{
    if (indexPath == _seletedIndexPath) {
        _seletedIndexPath = nil;
    }else{
        _seletedIndexPath = indexPath;
    }

    [self.tableView reloadData];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
